<?php

/**
 * 发送邮件记录模型
 * @author yanghj 2014.5.12
 */
class EmaillogModel extends BaseModel
{
    var $table  = 'email_log';
    var $prikey = 'email_log_id';
    var $_name  = 'emaillog';
    
    function add_edit($data, $user_id)
    {
        $email_log_id = $this->getOne("SELECT email_log_id FROM {$this->table} WHERE user_id = {$user_id} AND code_type = {$data['code_type']}");
        if (empty($email_log_id)) {
            return $this->add($data);
        } else {
            $this->edit($email_log_id, $data);
        }

    }

}

?>